package com.example.lab.mapper;

import com.example.lab.entity.Permissions;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 权限表 Mapper 接口
 * </p>
 *
 * @author 布莱恩
 * @since 2025-06-16
 */
@Mapper
public interface PermissionsMapper extends BaseMapper<Permissions> {

    @Select("SELECT p.* FROM permissions p " +
            "JOIN role_permissions rp ON p.permission_id = rp.permission_id " +
            "WHERE rp.role_id = #{roleId}")
    List<Permissions> findByRoleId(Integer roleId);

}
